home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / solomon.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  10KB  |  296 lines

  1. /***************************************************************************
  2.  
  3. Solomon's Key
  4.  
  5. driver by Mirko Buffoni
  6.  
  7. ***************************************************************************/
  8. #include "driver.h"
  9. #include "vidhrdw/generic.h"
  10. #include "cpu/z80/z80.h"
  11.  
  12.  
  13. extern unsigned char *solomon_bgvideoram;
  14. extern unsigned char *solomon_bgcolorram;
  15.  
  16. WRITE_HANDLER( solomon_flipscreen_w );
  17. WRITE_HANDLER( solomon_bgvideoram_w );
  18. WRITE_HANDLER( solomon_bgcolorram_w );
  19. int  solomon_vh_start(void);
  20. void solomon_vh_stop(void);
  21. void solomon_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  22.  
  23. static WRITE_HANDLER( solomon_sh_command_w )
  24. {
  25.     soundlatch_w(offset,data);
  26.     cpu_cause_interrupt(1,Z80_NMI_INT);
  27. }
  28.  
  29.  
  30. static struct MemoryReadAddress readmem[] =
  31. {
  32.     { 0x0000, 0xbfff, MRA_ROM },
  33.     { 0xc000, 0xcfff, MRA_RAM },    /* RAM */
  34.     { 0xd000, 0xdfff, MRA_RAM },    /* video + color + bg */
  35.     { 0xe000, 0xe07f, MRA_RAM },    /* spriteram  */
  36.     { 0xe400, 0xe5ff, MRA_RAM },    /* paletteram */
  37.     { 0xe600, 0xe600, input_port_0_r },
  38.     { 0xe601, 0xe601, input_port_1_r },
  39.     { 0xe602, 0xe602, input_port_2_r },
  40.     { 0xe604, 0xe604, input_port_3_r },    /* DSW1 */
  41.     { 0xe605, 0xe605, input_port_4_r },    /* DSW2 */
  42.     { 0xf000, 0xffff, MRA_ROM },
  43.     { -1 }    /* end of table */
  44. };
  45.  
  46. static struct MemoryWriteAddress writemem[] =
  47. {
  48.     { 0x0000, 0xbfff, MWA_ROM },
  49.     { 0xc000, 0xcfff, MWA_RAM },
  50.     { 0xd000, 0xd3ff, colorram_w, &colorram },
  51.     { 0xd400, 0xd7ff, videoram_w, &videoram, &videoram_size },
  52.     { 0xd800, 0xdbff, solomon_bgcolorram_w, &solomon_bgcolorram },
  53.     { 0xdc00, 0xdfff, solomon_bgvideoram_w, &solomon_bgvideoram },
  54.     { 0xe000, 0xe07f, MWA_RAM, &spriteram, &spriteram_size },
  55.     { 0xe400, 0xe5ff, paletteram_xxxxBBBBGGGGRRRR_w, &paletteram },
  56.     { 0xe600, 0xe600, interrupt_enable_w },
  57.     { 0xe604, 0xe604, solomon_flipscreen_w },
  58.     { 0xe800, 0xe800, solomon_sh_command_w },
  59.     { 0xf000, 0xffff, MWA_ROM },
  60.     { -1 }    /* end of table */
  61. };
  62.  
  63. static struct MemoryReadAddress solomon_sound_readmem[] =
  64. {
  65.     { 0x0000, 0x3fff, MRA_ROM },
  66.     { 0x4000, 0x47ff, MRA_RAM },
  67.     { 0x8000, 0x8000, soundlatch_r },
  68.     { -1 }    /* end of table */
  69. };
  70.  
  71. static struct MemoryWriteAddress solomon_sound_writemem[] =
  72. {
  73.     { 0x0000, 0x3fff, MWA_ROM },
  74.     { 0x4000, 0x47ff, MWA_RAM },
  75.     { 0xffff, 0xffff, MWA_NOP },    /* watchdog? */
  76.     { -1 }    /* end of table */
  77. };
  78.  
  79. static struct IOWritePort solomon_sound_writeport[] =
  80. {
  81.     { 0x10, 0x10, AY8910_control_port_0_w },
  82.     { 0x11, 0x11, AY8910_write_port_0_w },
  83.     { 0x20, 0x20, AY8910_control_port_1_w },
  84.     { 0x21, 0x21, AY8910_write_port_1_w },
  85.     { 0x30, 0x30, AY8910_control_port_2_w },
  86.     { 0x31, 0x31, AY8910_write_port_2_w },
  87.     { -1 }    /* end of table */
  88. };
  89.  
  90.  
  91.  
  92. INPUT_PORTS_START( solomon )
  93.     PORT_START    /* IN0 */
  94.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  95.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  96.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY )
  97.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  98.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 )
  99.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 )
  100.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  101.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  102.  
  103.     PORT_START    /* IN1 */
  104.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  105.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  106.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  107.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  108.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2 | IPF_COCKTAIL )
  109.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1 | IPF_COCKTAIL )
  110.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  111.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  112.  
  113.     PORT_START    /* COIN */
  114.     PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START1 )
  115.     PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
  116.     PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_COIN1 )
  117.     PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_COIN2 )
  118.     PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  119.     PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  120.     PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  121.     PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
  122.  
  123.     PORT_START    /* DSW1 */
  124.     PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) )
  125.     PORT_DIPSETTING(    0x01, DEF_STR( Off ) )
  126.     PORT_DIPSETTING(    0x00, DEF_STR( On ) )
  127.     PORT_DIPNAME( 0x02, 0x02, DEF_STR( Cabinet ) )
  128.     PORT_DIPSETTING(    0x02, DEF_STR( Upright ) )
  129.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  130.     PORT_DIPNAME( 0x0c, 0x00, DEF_STR( Lives ) )
  131.     PORT_DIPSETTING(    0x0c, "2" )
  132.     PORT_DIPSETTING(    0x00, "3" )
  133.     PORT_DIPSETTING(    0x08, "4" )
  134.     PORT_DIPSETTING(    0x04, "5" )
  135.     PORT_DIPNAME( 0x30, 0x00, DEF_STR( Coin_B ) )
  136.     PORT_DIPSETTING(    0x20, DEF_STR( 2C_1C ) )
  137.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  138.     PORT_DIPSETTING(    0x10, DEF_STR( 1C_2C ) )
  139.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_3C ) )
  140.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Coin_A ) )
  141.     PORT_DIPSETTING(    0x80, DEF_STR( 2C_1C ) )
  142.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  143.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  144.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_3C ) )
  145.  
  146.     PORT_START    /* DSW2 */
  147.     PORT_DIPNAME( 0x01, 0x00, "Unknown DSW2 1" )
  148.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  149.     PORT_DIPSETTING(    0x01, DEF_STR( On ) )
  150.     PORT_DIPNAME( 0x02, 0x00, "Unknown DSW2 2" )
  151.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  152.     PORT_DIPSETTING(    0x02, DEF_STR( On ) )
  153.     PORT_DIPNAME( 0x04, 0x00, "Unknown DSW2 3" )
  154.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  155.     PORT_DIPSETTING(    0x04, DEF_STR( On ) )
  156.     PORT_DIPNAME( 0x08, 0x00, "Unknown DSW2 4" )
  157.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  158.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  159.     PORT_DIPNAME( 0x10, 0x00, "Unknown DSW2 5" )
  160.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  161.     PORT_DIPSETTING(    0x10, DEF_STR( On ) )
  162.     PORT_DIPNAME( 0xe0, 0x00, DEF_STR( Bonus_Life ) )
  163.     PORT_DIPSETTING(    0x00, "30k 200k 500k" )
  164.     PORT_DIPSETTING(    0x80, "100k 300k 800k" )
  165.     PORT_DIPSETTING(    0x40, "30k 200k" )
  166.     PORT_DIPSETTING(    0xc0, "100k 300k" )
  167.     PORT_DIPSETTING(    0x20, "30k" )
  168.     PORT_DIPSETTING(    0xa0, "100k" )
  169.     PORT_DIPSETTING(    0x60, "200k" )
  170.     PORT_DIPSETTING(    0xe0, "None" )
  171. INPUT_PORTS_END
  172.  
  173.  
  174.  
  175. static struct GfxLayout charlayout =
  176. {
  177.     8,8,    /* 8*8 characters */
  178.     2048,    /* 2048 characters */
  179.     4,    /* 4 bits per pixel */
  180.     { 0, 1, 2, 3 },    /* the bitplanes are packed in one nibble */
  181.     { 0*4, 1*4, 2*4, 3*4, 4*4, 5*4, 6*4, 7*4 },
  182.     { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32 },
  183.     32*8    /* every char takes 32 consecutive bytes */
  184. };
  185.  
  186. static struct GfxLayout spritelayout =
  187. {
  188.     16,16,    /* 8*8 sprites */
  189.     512,    /* 512 sprites */
  190.     4,        /* 4 bits per pixel */
  191.     { 0, 512*32*8, 2*512*32*8, 3*512*32*8 },    /* the bitplanes are separated */
  192.     { 0, 1, 2, 3, 4, 5, 6, 7,    /* pretty straightforward layout */
  193.             8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  194.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  195.             16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  196.     32*8    /* every sprite takes 32 consecutive bytes */
  197. };
  198.  
  199. static struct GfxDecodeInfo gfxdecodeinfo[] =
  200. {
  201.     { REGION_GFX1, 0, &charlayout,     0, 8 },    /* colors   0-127 */
  202.     { REGION_GFX2, 0, &charlayout,   128, 8 },    /* colors 128-255 */
  203.     { REGION_GFX3, 0, &spritelayout,   0, 8 },    /* colors   0-127 */
  204.     { -1 } /* end of array */
  205. };
  206.  
  207. static struct AY8910interface ay8910_interface =
  208. {
  209.     3,    /* 3 chips */
  210.     1500000,    /* 1.5 MHz?????? */
  211.     { 12, 12, 12 },
  212.     { 0 },
  213.     { 0 },
  214.     { 0 },
  215.     { 0 }
  216. };
  217.  
  218. static struct MachineDriver machine_driver_solomon =
  219. {
  220.     /* basic machine hardware */
  221.     {
  222.         {
  223.             CPU_Z80,
  224.             4000000,    /* 4.0 Mhz (?????) */
  225.             readmem,writemem,0,0,
  226.             nmi_interrupt,1
  227.         },
  228.         {
  229.             CPU_Z80 | CPU_AUDIO_CPU,
  230.             3072000,    /* 3.072 Mhz (?????) */
  231.             solomon_sound_readmem,solomon_sound_writemem,0,solomon_sound_writeport,
  232.             interrupt,2    /* ??? */
  233.                         /* NMIs are caused by the main CPU */
  234.         },
  235.     },
  236.     60, DEFAULT_60HZ_VBLANK_DURATION,    /* frames per second, vblank duration */
  237.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  238.     0,
  239.  
  240.     /* video hardware */
  241.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  242.     gfxdecodeinfo,
  243.     256, 256,
  244.     0,
  245.  
  246.     VIDEO_TYPE_RASTER | VIDEO_MODIFIES_PALETTE | VIDEO_SUPPORTS_DIRTY,
  247.     0,
  248.     solomon_vh_start,
  249.     solomon_vh_stop,
  250.     solomon_vh_screenrefresh,
  251.  
  252.     /* sound hardware */
  253.     0,0,0,0,
  254.     {
  255.         {
  256.             SOUND_AY8910,
  257.             &ay8910_interface
  258.         }
  259.     }
  260. };
  261.  
  262. /***************************************************************************
  263.  
  264.   Game driver(s)
  265.  
  266. ***************************************************************************/
  267.  
  268. ROM_START( solomon )
  269.     ROM_REGION( 0x10000, REGION_CPU1 )    /* 64k for code */
  270.     ROM_LOAD( "slmn_06.bin",  0x00000, 0x4000, 0xe4d421ff )
  271.     ROM_LOAD( "slmn_07.bin",  0x08000, 0x4000, 0xd52d7e38 )
  272.     ROM_CONTINUE(             0x04000, 0x4000 )
  273.     ROM_LOAD( "slmn_08.bin",  0x0f000, 0x1000, 0xb924d162 )
  274.  
  275.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  276.     ROM_LOAD( "slmn_01.bin",  0x0000, 0x4000, 0xfa6e562e )
  277.  
  278.     ROM_REGION( 0x10000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  279.     ROM_LOAD( "slmn_12.bin",  0x00000, 0x08000, 0xaa26dfcb )    /* characters */
  280.     ROM_LOAD( "slmn_11.bin",  0x08000, 0x08000, 0x6f94d2af )
  281.  
  282.     ROM_REGION( 0x10000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  283.     ROM_LOAD( "slmn_10.bin",  0x00000, 0x08000, 0x8310c2a1 )
  284.     ROM_LOAD( "slmn_09.bin",  0x08000, 0x08000, 0xab7e6c42 )
  285.  
  286.     ROM_REGION( 0x10000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  287.     ROM_LOAD( "slmn_02.bin",  0x00000, 0x04000, 0x80fa2be3 )    /* sprites */
  288.     ROM_LOAD( "slmn_03.bin",  0x04000, 0x04000, 0x236106b4 )
  289.     ROM_LOAD( "slmn_04.bin",  0x08000, 0x04000, 0x088fe5d9 )
  290.     ROM_LOAD( "slmn_05.bin",  0x0c000, 0x04000, 0x8366232a )
  291. ROM_END
  292.  
  293.  
  294.  
  295. GAME( 1986, solomon, 0, solomon, solomon, 0, ROT0, "Tecmo", "Solomon's Key (Japan)" )
  296.